package com.weipai.springboot.module.dao.impl;

import com.weipai.springboot.model.CommissionRate;
import com.weipai.springboot.model.Freight;
import com.weipai.springboot.module.dao.SystemDao;
import com.weipai.springboot.module.mapper.CommissionRateMapper;
import com.weipai.springboot.module.mapper.FreightMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @Author: 曹朋飞
 * @Date: 2018/09/01 10:57
 */
@Repository
public class SystemDaoImpl implements SystemDao{
    
    @Autowired
    CommissionRateMapper commissionRateMapper;
    @Autowired
    FreightMapper freightMapper;

    //保存员工提成比例
    @Override
    public int saveCommissionRate(CommissionRate commissionRate) {
        return commissionRateMapper.insert(commissionRate);
    }

    //根据类型获得比例
    @Override
    public Map<String, Object> getCommissionRateByType(Integer type) {
        return commissionRateMapper.getCommissionRateByType(type);
    }

    //修改提成比例
    @Override
    public int updateCommissionRateById(Integer id, Integer rate) {
        return commissionRateMapper.updateCommissionRateById(id, rate);
    }

    //获取运费
    @Override
    public Freight getFreight() {
        return freightMapper.getFreight();
    }

    //修改运费
    @Override
    public int updateFreight(Integer freightId, Integer fullPackage, Integer freight) {
        return freightMapper.updateFreight(freightId, fullPackage, freight);
    }
}
